﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using System.Diagnostics;
using System.Linq;

namespace Aliang.EventBus.IntegrationEventLogEF
{
    public class SqlServerIntegrationEventLogContextDesignTimeFactory : IDesignTimeDbContextFactory<SqlServerIntegrationEventLogContext>
    {
        public SqlServerIntegrationEventLogContext CreateDbContext(string[] args)
        {
            var optionsBuilder = new DbContextOptionsBuilder<SqlServerIntegrationEventLogContext>();

            optionsBuilder.UseSqlServer(".", options => options.MigrationsAssembly(GetType().Assembly.GetName().Name));

            return new SqlServerIntegrationEventLogContext(optionsBuilder.Options);
        }
    }
}